package com.um.jdy.tcp.sdk;

import com.alibaba.fastjson.JSON;
import com.um.jdy.tcp.uplink.UplinkCommand;
import com.um.jdy.tcp.uplink.UplinkCommandFactory;
import com.um.jdy.tcp.cmd.SDKCommand;
import com.um.jdy.tcp.cmd.SDKCommandParser;
import org.springframework.stereotype.Component;

/**
 * @author 邓南辉
 * 日期 2023/8/28
 * 版权所有 广州优匠科技有限公司
 */
@Component
public class SDKCommandParserImpl implements SDKCommandParser {
    @Override
    public SDKCommand parse(String command) {
        UplinkCommand cmd = UplinkCommandFactory.createCommand(command);
        return cmd;
    }

    @Override
    public String toCommandString(SDKCommand command) {
        return JSON.toJSONString(command);
    }
}
